package com.gnehcnij.mall.springboot.controller;

import com.gnehcnij.mall.bean.UserAddress;
import com.gnehcnij.mall.service.OrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class OrderController {

    private final OrderService orderService;

    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @ResponseBody
    @RequestMapping(value = "/initOrder")
    public List<UserAddress> initOrder(@RequestParam(value = "uid") String uid) {
        return orderService.initOrder(uid);
    }

    @ResponseBody
    @RequestMapping(value = "/ssss")
    public String sss() {
        return orderService.toString();
    }

}
